package com.fengchao.api.service;

import com.fengchao.api.dao.msg.MsgCustomerComplaintMapper;
import com.fengchao.model.msg.MsgCustomerComplaint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * Created by Administrator on 2016/6/28.
 */
@Service
public class MsgService{

    @Autowired
    private MsgCustomerComplaintMapper msgCustomerComplaintMapper;

    @Transactional
    public boolean suggest(Integer userId, String context, String mobile) {
        MsgCustomerComplaint msgCustomerComplaint = new MsgCustomerComplaint();
        msgCustomerComplaint.setUserId(userId);
        msgCustomerComplaint.setContext(context);
        msgCustomerComplaint.setMobile(mobile);
        msgCustomerComplaint.setCreateTime(new Date());
        Integer count = msgCustomerComplaintMapper.insertSelective(msgCustomerComplaint);
        if (count > 0) {
            return true;
        }
        return false;
    }
}
